﻿@{
    ViewBag.Title = "举报管理 - " + ViewBag.DomainTitle;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<table class="layui-table" lay-filter="dataTable" lay-data="{id:'dataTable',height:'full-0',method:'post',cellMinWidth:120,page:true,limit:20,url:'/Complain/AjaxData'}">
    <thead>
        <tr>
            <th lay-data="{field:'CreateTime'}">举报时间</th>
            <th lay-data="{field:'ObjectID'}">被举报对象ID</th>
            <th lay-data="{field:'ObjectTypeName'}">举报类型</th>
            <th lay-data="{field:'Content'}">举报内容</th>
            <th lay-data="{field:'ProcessingName'}">处理方式</th>
            <th lay-data="{field:'Remark'}">备注</th>
            <th lay-data="{fixed: 'right', width:150, align:'center', toolbar: '#tmpToolBar'}">操作</th>
        </tr>
    </thead>
</table>

<script type="text/html" id="tmpToolBar">
    <a class="layui-btn layui-btn-xs" href="javascript:void(0)" onclick="javascript: { openProce({{ d.ID }}); }">处理</a>
</script>

<div id="proceInfo">
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">状态信息</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form query-form" id="proceForm">
                    <input type="text" id="complainId" name="complainId" value="" class="layui-hide" />
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">审核状态</label>
                            <div class="layui-input-inline">
                                <select name="processing">
                                    @foreach (var item in Enum.GetValues(typeof(QunProject.Model.EnumHelper.Processing)))
                                    {
                                        <option value="@((int)item)">@item.ToString()</option>
                                    }
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">原因</label>
                            <div class="layui-input-inline">
                                <textarea name="remark" class="layui-textarea"></textarea>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <span class="layui-btn layui-btn-sm" onclick="javascript: { submitProcessing(); }">保存</span>
                            <span class="layui-btn layui-btn-warm layui-btn-sm" onclick="javascript: { ejectProce.close(); }">关闭</span>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

@Html.Partial("~/Views/Shared/_Script.cshtml")

<script>
    var table = layui.table;
    var ejectProce = new Eject();
    ejectProce.init({
        elm: '#proceInfo',
        width: '400px',
        obj: 'ejectProce'
    });
    // 刷新table
    function tableReload() {
        table.reload('dataTable', { page: { curr: 1 } });
    };
    // 打开处理
    function openProce(complainId) {
        $('#complainId').val(complainId);
        ejectProce.open();
    };
    // 提交删除
    function submitProcessing(complainId, processing, remark) {
        var proceData = $('#proceForm').getForm();
        $.post('/Complain/AjaxProcessing', proceData, function (result) {
            layer.msg(result.msg);
            tableReload();
        });
    };
</script>